#include "dyn_quad_qGauss.h"

double qGauss::doQuadrature()
{
    // Compute the sum of the weights multiplied by
    // the values of the function at the abscissas.
    double sum = 0.0;

    // Parameters to rescale
    double h = (b-a)/2.0;
    double avg = (a+b)/2.0;

    for (unsigned int i=0;i<weights.n_rows;i++)
    {
        sum += h*weights(i)*func(h*abscissas(i)+avg);
    }
    return sum;
}
